<?php $this->_extends(Helper_Store::layout()); ?>
<?php $this->_block('title'); ?>Shopping Cart View -  <?=$store['name']?> <?php $this->_endblock(); ?>
<?php $this->_block('contents'); ?>
<?php if(isset($cart['goods'])&&count($cart['goods'])):?>
<div id="MainWrap">

<div id="cart-index" class="CartWrap">
<div class="CartNav clearfix">
<div class="floatLeft">
<img alt=" View Cart " src="<?=$_BASE_DIR;?>statics/cartnav-step1.gif"/>
</div>
<div class="floatRight">
<img src="<?=$_BASE_DIR;?>statics/cartnav-cart.gif"/>
</div>
</div>
<div id="cart-items" class="section">
<form id="form-cart" extra="cart" method="post" action="<?=url('cart/index')?>">
<div id="cartItems" class="FormWrap">
<h3>Goods In Cart:</h3>
<div id="goodsbody" class="division">
<table class="liststyle" cellspacing="0" cellpadding="3" width="100%">
<col class="span-2 "/>
<col class="span-auto"/>
<col class="span-2"/>
<col class="span-2"/>
<col class="span-3"/>
<col class="span-2 ColColorOrange"/>
<col class="span-2"/>
<thead>
<tr>
<th height="44"></th>
<th>Name</th>
<th>Price </th>
<th>Number </th>
<th> Total </th>
<th> Delete </th>
</tr>
</thead>
<tbody>
<?php $amount=0;
			foreach($goods as $g):
				$sg=$cart['goods'][$g->goods_id];
				$q=$sg['quantity'];
				$total=$q*$g->price;
				$amount+=$total;
		?>
<tr >
<td>
<a style="margin: 0pt; padding: 0pt; text-decoration: none;" target="_blank_product" href="<?=url('default/product',array('goods_id'=>$g->goods_id))?>">
<span class="cart-product-img" style="display: block; width: 50px; height: 50px;" isrc="<?=$g->imgurl?>">
<img height="50" width="41" src="<?=$g->imgurl?>" style="cursor: pointer;"/>
</span>
</a>
</td>
<td style="text-align: left;">
<a target="_blank_product" href="<?=url('default/product',array('goods_id'=>$g->goods_id))?>"><?=$g->title?></a>
</td>
<td> <?=Helper_currency::fetch($g->price,$g->currency)?> </td>
<td>
<div class="">
<input class="_x_ipt textcenter" type="text" name="quantity[<?=$g->goods_id?>]" size="5" value="<?=$sg['quantity']?>"/>
<span class="numadjust increase" price="<?=$total?>"/>
<span class="numadjust decrease" price="<?=$total?>"/>
</div>
</td>
<td class="itemTotal"><?=Helper_currency::fetch($total,$g->currency)?></td>
<td>
<span class="lnk quiet"><a href="<?=url('cart/RemoveGood',array('goods_id'=>$g->goods_id))?>">Delete</a></span>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<div id="cartTotal" class="division">
<table class="liststyle_data" cellspacing="0" cellpadding="3" width="100%">
<col class="span-auto"/>
<col class="span-4 ColColorOrange"/>
<tbody>
<tr class="totalprice">
<th align="right">Amout：</th>
<td>
<span class="price1"><?=Helper_currency::fetch($amount,$g->currency)?></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="CartBtn clearfix" style="margin-bottom: 5px;">
<div class="span-auto">
<input class="btn-return actbtn" type="button" value="  Continue Buy " onClick="window.location='<?=url('default/list')?>'" style="width: 90px;"/>
</div>
<div class="span-auto">
<input id="clearCart" class="btn-clearcat actbtn" type="button" value="  Clear   " style="width: 90px;" onClick="window.location='<?=url('cart/destroy')?>'" style="width: 90px;" />
</div>
<div class="span-auto floatRight">
<input class="btn-next actbtn" type="submit" value="  Checkout  "/>
</div>
</div>
</form>
</div>
<form id="cart-coupon" method="post" action="<?=url('cart/coupon')?>">
<div class="FormWrap"  title="Please type your coupon code into the box next to Redemption Code. Your coupon will be applied to the total and reflected in your cart after you click continue. ">
<h3>Discount Coupon</h3>
<div class="division">
<?php
 if(isset($cart['coupon'])&&strlen($cart['coupon'])):?>
	Redemption Code : <span class="text"><?=$cart['coupon']?></span>
<?php else:?>
<input id="-s-ipt-coupon" class="_x_ipt text" type="text" vtype="text" size="30" name="coupon" autocomplete="off" title="you may only use one coupon per order." />
<input type="submit" value="Redemption Code"/>
<?php endif;?>
</div>
</div>
</form>

</div>
<?php else:?>
<p id="cart-none-msg">
<div class="notice">
	No Products in cart !
</div>
<h3>Now You can:</h3>
<ul class='list'><li><a href='<?=url('default')?>'>Return Home</a></li><li><a href='javascript:opener=null;window.close();'>Close</a></li></ul>
</p>
<?php endif;?>

<div style="clear:both"></div>
	
<?php $this->_endblock('contents'); ?>
